package com.luoyi.weather.impl;

import com.luoyi.weather.DisplayElement;
import com.luoyi.weather.Obverse;
import com.luoyi.weather.Subject;

public class CurrentConditionDisplay implements Obverse, DisplayElement {

    private float temp;
    private float humidity;
    private float pressure;

    private Subject weatherData;

    public CurrentConditionDisplay(Subject weatherData) {
        this.weatherData = weatherData;
        weatherData.registerObverse(this);
    }

    @Override
    public void disPlay() {
        System.out.println("temp = " + temp + "humidity = " + humidity + "pressure = " + pressure);
    }

    @Override
    public void update(float temp, float humidity, float pressure) {
        this.temp = temp;
        this.humidity = humidity;
        this.pressure = pressure;
        disPlay();
    }
}
